from airtest.core.android import Android
from airtest.core.api import *
import logging

logging.getLogger("airtest").setLevel(logging.WARNING)

device: Android = init_device('Android')
# 判断设备是否锁定
is_locked = device.is_locked()
print(f'is_locked: {is_locked}')

if is_locked:
    # 如果锁定，进行解锁
    device.unlock()
# 唤醒设备
device.wake()
# 列举设备上所有App
app_list = device.list_app()
print(f'app list {app_list}')
# 获取当前设备的uuid
uuid = device.uuid
print(f'uuid {uuid}')
# 获取当前的显示信息，如屏幕宽高等
display_info = device.get_display_info()
print(f'display_info {display_info}')
# 获取当前渲染的分辨率
resolution = device.get_render_resolution()
print(f'resolution {resolution}')
# 获取ip地址
ip_address = device.get_ip_address()
print(f'ip_address {ip_address}')
# 获取当前Activity
top_activity = device.get_top_activity()
print(f'top_activity {top_activity}')
# 判断当前是否显示键盘了
is_keyboard_shown = device.is_keyboard_shown()
print(f'is_keyboard_shown {is_keyboard_shown}')